//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <fstream>

#include "InhibitorsBioAssayKd.h"
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
using namespace std;
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
int main(int argc, char** argv) {

  String* namefileListInhibitors;
  String* namefileListProteins;
  String* namefileMatrix;
  String* namefileResult;

  int     option = 0;

  if (argc < 5) {
    cout << "Error in the input arguments. The execution must be: " << endl;
    cout << "./InhibitorKdDistance <File with inhibitors label list> <File with protein label list> <File with the matrix of Kd values> <Output File> <Option>" << endl;
    return 0;
  }
  else {
    cout << "---------------------------------------------------------------------------------" << endl;
    cout << "             File with inhibitors label list : " << argv[1] << endl;
    cout << "                File with protein label list : " << argv[2] << endl;
    cout << "           File with the matrix of Kd values : " << argv[3] << endl;
    cout << "                                 Output File : " << argv[4] << endl;
    if (argc == 6)
      cout << " Option (Not Normalized = 0, Normalized = 1) : " << argv[5] << endl;
    cout << "---------------------------------------------------------------------------------" << endl;
    namefileListInhibitors = new String(argv[1]);
    namefileListProteins   = new String(argv[2]);
    namefileMatrix         = new String(argv[3]);
    namefileResult         = new String(argv[4]);
    option                 = atoi(argv[5]);
  }

  InhibitorsBioAssayKd* inhibitorsBioAssayKd = new InhibitorsBioAssayKd();

  inhibitorsBioAssayKd->NamefileListInhibitors(namefileListInhibitors);
  inhibitorsBioAssayKd->NamefileListProteins(namefileListProteins);
  inhibitorsBioAssayKd->NamefileMatrix(namefileMatrix);
  inhibitorsBioAssayKd->NamefileResult(namefileResult);

  inhibitorsBioAssayKd->LoadListFile();
  inhibitorsBioAssayKd->LoadMatrix();

  if (!option)
    inhibitorsBioAssayKd->ComputeNormalizedKdEuclidianDistance();
  else
    inhibitorsBioAssayKd->ComputeKdEuclidianDistance();

  cout << "---------------------------------------------------------------------------------" << endl;

  if (inhibitorsBioAssayKd) delete inhibitorsBioAssayKd;

  return 1;

}
//---------------------------------------------------------------------------------------------------------------------------------------------------------//
//---------------------------------------------------------------------------------------------------------------------------------------------------------//


